/*
 * @Description: 登录相关
 * @Author: chenju
 * @Date: 2021-06-07 14:57:27
 * @LastEditors: chenju
 * @LastEditTime: 2022-09-05 18:11:01
 */
import axios from 'axios';
import config from '@/config';
import qs from 'qs';
// 创建权限相关的axios
const authAxios = axios.create();

export interface OAuthParams {
  grant_type: string;
  refresh_token: string;
  scope: 'server';
}

// auth的post方法
export const authPost = (params: OAuthParams): any => {
  return authAxios({
    method: 'post',
    url: '/auth/oauth/token?' + qs.stringify(params),
    baseURL: config.BASE_URL,
    headers: {
      Authorization: 'Basic Zm9vdHByaW50OmZvb3RwcmludA==',
      'Content-Type': 'application/json'
    },
    timeout: config.TIMEOUT
  });
};
